package com.cms.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cms.entity.Web;
import com.cms.mapper.WebMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 网站信息表 服务实现类
 * </p>
 *
 * @author songfayuan
 * @since 2021-11-12
 */
@Service
public class WebService extends ServiceImpl<WebMapper, Web> {

    /**
     * 根据站点ID查询网站信息
     *
     */
    public Web findBySiteId(Integer siteId){
        QueryWrapper<Web> queryWrapper = new QueryWrapper();
        queryWrapper.eq("siteId",siteId);
        return baseMapper.selectOne(queryWrapper);
    }

    /**
     * 根据站点ID删除网站信息
     *
     */
    public void deleteBySiteId(List<Integer> siteIds){
        QueryWrapper<Web> queryWrapper = new QueryWrapper();
        queryWrapper.in("siteId",siteIds);
        baseMapper.delete(queryWrapper);
    }

}
